import _ from 'lodash'
export function setLrTarArr(arr, lrObj) {
    let newArr = _.cloneDeep(arr)
    let newLrObj = _.cloneDeep(lrObj)
    let newArr1 = newArr.find(item => item.name == newLrObj.left.isAttrLr)?.attributeList || []
    let newArr2 = newArr.find(item => item.name == newLrObj.right.isAttrLr)?.attributeList || []
    newArr1 = newArr1.map(item => {
        return {
            id: 'left-attr',
            name: `${newLrObj.left.as || newArr1.name}.${item.name}`,
            value: `${newLrObj.left.as || newArr1.name}.${item.name}`,
            valueType: `${newLrObj.left.as || newArr1.name}.${item.name}`,
            nameScpe: item.name,
            isOption: true

        }
    })
    newArr2 = newArr2.map(item => {
        return {
            id: 'right-attr',
            name: `${newLrObj.right.as || newArr2.name}.${item.name}`,
            value: `${newLrObj.right.as || newArr2.name}.${item.name}`,
            valueType: `${newLrObj.right.as || newArr2.name}.${item.name}`,
            nameScpe: item.name,
            isOption: true

        }
    })
    newArr1 = newArr1.concat(newArr2)
    return newArr1
}